Repository navigation
[58_maintenance] fix(arrow-schema): validate UnionFields when deserializing - #11760
Merged
Merged
Conversation
…11638) - Closes apache#11576. `UnionFields` derived `Deserialize`, so deserializing could build a value with duplicate or negative type ids, skipping the checks that `Serialize` is still derived (transparent), but `Deserialize` is now implemented by hand: it reads the same sequence of `(type_id, field)` pairs and builds the value with `UnionFields::try_new`, returning a serde error if validation fails. The wire format doesn't change, so anything serialized before still deserializes as long as it was valid. I kept serde rather than removing it, since `DataType` (and therefore `Field` and `Schema`) derive serde and need `UnionFields` to support it. Yes, two new tests in `fields.rs` (behind the `serde` feature, using `postcard` like the existing `Field` serde tests): a round trip of a valid `UnionFields`, and deserializing input with a duplicate type id and with a negative type id, both of which now fail. The second test fails without this change. Deserializing an invalid `UnionFields` (or a `DataType::Union` containing one) now returns an error instead of succeeding. AI disclosure: I used an AI coding assistant to write the change, the tests and this description, and I reviewed all of it. --------- Co-authored-by: ump45nose <ump45nose@users.noreply.github.com>
4 of 5 tasks
Jefffrey
marked this pull request as ready for review
October 21, 2026 12:09
Rich-T-kid
approved these changes
Oct 21, 2026
Contributor
|
Merging as MSRV failure is unrelated. I will fix in this PR Audit was fixed by a prior PR |
Contributor
|
(actually I take it back, we need to resolve a conflict. Iw ill do so) |
…638_58 # Conflicts: # arrow-schema/src/fields.rs
alamb
approved these changes
Oct 22, 2026
Contributor
|
Audit failure should be fixed in so merging this one |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
UnionFieldswhen deserializing #1163858.4.1(October 2026) #11665Cherry-pick of a2b405f